home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / self / contrib.lha / contrib / 491 / aa / boites.self < prev    next >
Encoding:
Text File  |  1993-07-13  |  20.5 KB  |  794 lines

  1. " Implementation of graphics boxes (a la TeX) for Self"
  2.  
  3. "
  4. *
  5. * boites.self,v 1.17 1993/07/13 21:46:58 richards Exp
  6. *
  7. * /home/2user2/richards/cvs/491/aa/boites.self,v 1.17 1993/07/13 21:46:58 richards Exp
  8. * *Header: /home/14user1/richards/RCS/boites.self,v 1.5 1992/09/23 18:56:59 richards Exp richards *
  9. *
  10. * boites.self,v
  11. * Revision 1.17  1993/07/13  21:46:58  richards
  12. * July 13 checkin.
  13. *
  14. * Revision 1.16  1993/06/24  21:24:30  richards
  15. * Split drawing out of boites and into light weight views.
  16. *
  17. * Revision 1.15  1993/06/23  21:18:07  richards
  18. * Daily checkin.
  19. *
  20. * Revision 1.14  1993/06/23  02:04:21  richards
  21. * Progress towards being able to select equations.
  22. *
  23. * Revision 1.13  1993/06/23  00:36:04  richards
  24. * Fixed up test1 to work with new code.
  25. * boites and window have first hack at highlighting code.
  26. *
  27. * Revision 1.12  1993/06/21  21:39:22  richards
  28. * Added highlighting.
  29. * Moved gc cache into viewManager.
  30. *
  31. * Revision 1.11  1993/06/18  21:25:36  richards
  32. * Moved font support into viewManager.
  33. * Starting to add selection stuff into window and boite.
  34. * Boites refer properly back to the polynomial structures.
  35. *
  36. * Revision 1.10  1993/05/31  20:27:50  richards
  37. * symbols has the whole greek alphabet, but some letters are not named right.
  38. * window.self now uses two sub-classes of compoundView, one inside the other.
  39. * (Still have problem identifying them...)
  40. * test7 obsolete.
  41. * Fixed some problems with font positioning in boites and poly.
  42. *
  43. * Revision 1.9  1993/05/31  00:12:10  richards
  44. * May 30 checkin. Font support is nearly debugged.
  45. * Make use of glue now.
  46. * Added rational (fraction) types.
  47. *
  48. * Revision 1.8  1993/05/30  21:41:14  richards
  49. *  Starting to add font support to text boites.
  50. *
  51. * Revision 1.7  1993/05/23  23:16:47  richards
  52. * New X library drawing primitives incorporated.
  53. * Limited font support. (Gets the sizes wrong)
  54. * expandSubBoites written, and working.
  55. *
  56. # Revision 1.6  1993/05/14  22:35:54  richards
  57. # Full use of bnum class is now implemented, and proper copying of
  58. # objects is now done.
  59. #
  60. # Revision 1.5  1992/09/23  18:56:59  richards
  61. # This is very strange. Self appears to not accept multiple arguments to a
  62. # block, and I seem to have no idea how to declare local variables within a 
  63. # block without introducing a sub-block.
  64. # Attempt at a work-around.
  65. #
  66. # Revision 1.4  1992/09/08  02:09:45  richards
  67. # Added makeRequiredSizes for the vboite and hboite. expandSubBoites is a
  68. # nifty problem though since the Scheme code has a nice accessor function.
  69. # Perhaps we really do need a (x,posy,negy) object. Hmm. Ponder.
  70. # Probably.
  71. #
  72. # Revision 1.3  1992/08/19  02:41:41  richards
  73. # Added fixUpSizes to start the TeX glue algorithm.
  74. #
  75. *
  76. *
  77. "
  78.  
  79. aa _AddSlotsIfAbsent: (| boites = () |)
  80.  
  81. aa boites _AddSlotsIfAbsent: (|
  82.     traits=().
  83.     prototypes* = (). 
  84.     mixins=().
  85. |)
  86.  
  87. aa boites traits _AddSlotsIfAbsent: (|
  88.     proto_boite=().
  89.     hboite = ().
  90.     vboite = ().
  91.     htext  = ().
  92.     vtext  = ().
  93.     glueboite = ().
  94.     hglue  = ().
  95.     vglue  = ().
  96.     hline  = ().
  97.     vline  = ().
  98. |)
  99.  
  100. aa boites prototypes _AddSlotsIfAbsent: (|
  101.     proto_boite=().
  102.     hboite = ().
  103.     vboite = ().
  104.     htext  = ().
  105.     vtext  = ().
  106.     hglue  = ().
  107.     vglue  = ().
  108.     hline  = ().
  109.     vline  = ().
  110. |)
  111.  
  112. aa boites mixins _AddSlotsIfAbsent: (|
  113.     containerboite = ().
  114.     textboite      = ().
  115. |)
  116.  
  117. " NOTES ON COORDINATES 
  118.   ********************
  119.   
  120.   - There is a transition occuring between referring to SIZES as x/y
  121. to now using x/y for position and xSize/ySize for this function.
  122. width/height are not isomorphic, as width is a bnum, but height is
  123. posy+negy. 
  124.   - there are three coordinates: width, upheight and downheight. That
  125. is, there is a definite baseline to which objects are relative to.
  126.   - Sizes upwards are downwards are always positive!
  127.   - y coordinates go from top->bottom
  128.   - x coordinates go from left->right
  129.   
  130. "
  131.  
  132. aa boites traits proto_boite _Define: (|
  133.     parent* = traits clonable.
  134.     identityness** = mixins identity.
  135.  
  136.     copy = ( | new. |
  137.     new: clone.
  138.     new width: width copy.
  139.     new upheight: upheight copy.
  140.     new downheight: downheight copy.
  141.     ^new).
  142.     x    =      ( width value ).   " depreciated "
  143.     xSize =     ( width value ).
  144.     posy =      ( upheight value ).   " depreciated "
  145.     upY  =      ( upheight value ).
  146.     negy =      ( downheight value ).  " depreciated "
  147.     downY =     ( downheight value ).
  148.     x: val =    ( width value: val ).  " depreciated "
  149.     xSize: val = ( width value: val ).
  150.     posy: val = ( upheight value: val).  " depreciated "
  151.     negy: val = ( downheight value: val).  " depreciated "
  152.     boiteType = 'unknown'.
  153.     sizeString  = ( ' [',
  154.         width value printString,',',
  155.         upheight value printString,'/',
  156.         downheight value printString,']').
  157.     printString = ( 'An ' , boiteType, sizeString ).
  158.     
  159.     setMinSizes = (
  160.     x: width lower.
  161.     posy: upheight lower.
  162.     negy: downheight lower.
  163.     ^self).
  164.  
  165.     fixUpSizes  = ( setMinSizes. ).
  166.     height      = ( posy + negy ).
  167.     ySize       = ( posy + negy ).
  168.     extent      = ( xSize@@ySize ).
  169.  
  170.  
  171.     makeRequiredSizes = (
  172.     setMinSizes.
  173.     fixUpSizes.
  174.     makeRequiredSizes: x PosY: posy NegY: negy.
  175.     ).
  176.  
  177.     makeRequiredSizes: xSize PosY: yPosSize NegY: yNegSize = (
  178. "    ('Setting ',printString,' to ',xSize printString,',',yPosSize printString,'/',yNegSize printString) printLine."
  179.     x: xSize.
  180.     posy: yPosSize.
  181.     negy: yNegSize.
  182.     ).
  183.  
  184.     " No default. "
  185.     fixUpFonts: win = ( ^self ).
  186.  
  187.     "This property should be set if a vboite should consider the"
  188.     "vertical center of the boite as its vertical center (baseline)"
  189.     vboiteCenters = false.                    
  190.     
  191.     " The following booleans are used by parts of the system to make decisions "
  192.     " that can't be encoded in the object hierarchy via message sends "
  193.     " This implements a kind of `isKindOf' "
  194.     vboite = false.
  195.     hboite = false.
  196.     htext  = false.
  197.     vtext  = false.
  198.     hglue  = false.
  199.     vglue  = false.
  200.     hline  = false.
  201.     vline  = false.
  202.     
  203.     " Actually, any code that really wants to work right, should test for "
  204.     " specific capabilities, so provide some defaults. "
  205.     vexpandable = false.
  206.     hexpandable = false.
  207.  
  208.     defaultPolyObject: po = (
  209.     polyObject isNil ifTrue: [ polyObject: po ].
  210.     ).
  211.  
  212.     bbox = ((0@(posy negate))#(xSize@negy)).
  213.  
  214.     contains: aBoite = (
  215.     (aBoite == self)
  216.     ).
  217.  
  218.     " follows the boite structure upwards until a different polyObject is seen"
  219.     upPolyObject = (| up. |
  220.     up: self.
  221.     [(up isNil not) && [up polyObject = polyObject]] whileTrue: [ up: up containedIn ].
  222.     up
  223.     ).
  224.  
  225.     " follows the boite structure upwards while we see the same polyObject "
  226.     canonicalPolyObject = (| up. last. |
  227.     up: self.
  228.     last: up.
  229.     [(up isNil not) && [up polyObject = polyObject]] whileTrue: [ last: up. up: up containedIn ].
  230.     last
  231.     ).
  232.     
  233.  
  234.     " perform block only for things with no substructure "
  235.     leafsDo: aBlock = (
  236.     aBlock value: self
  237.     ).
  238.  
  239. |)
  240.  
  241. aa boites mixins containerboite _Define: (|
  242.     copy    = (| new |
  243.     new: resend.copy.        
  244.     new contents: contents copy.
  245.     ^new
  246.     ).
  247.     printString = (| str. |
  248.     str: 'An ',boiteType,sizeString,' containing: \n'.
  249.     contents do: [ | :aThing |
  250.         str: str, '\t', aThing printString, '\n'.
  251.     ].
  252.     ^str
  253.     ).
  254.     addEnd:   thing = (
  255.     contents addLast: thing.
  256.     thing defaultPolyObject: polyObject.
  257.     thing containedIn: self.
  258.     thing.
  259.     ).
  260.     addBegin: thing = (
  261.     contents addFirst: thing.
  262.     thing defaultPolyObject: polyObject.
  263.     thing containedIn: self.
  264.     thing.
  265.     ).
  266.  
  267.     " setMinSizes "
  268.     setMinSizes = (
  269.     contents do: [ | :aThing |
  270.         aThing setMinSizes.
  271.     ].
  272.     ).
  273.  
  274.     expandSubBoites: expandList From: oldSize To: newSize ChangeBlock: expandBlock FetchBlock: curSizeBlock =
  275.     (| sizeChange. expandBit. |
  276.     sizeChange: newSize - oldSize.
  277.     ((sizeChange > 0) && [expandList nonEmpty]) ifTrue: [
  278.         expandBit: sizeChange /+ expandList size.
  279.         expandList do: [| :aSubBoite |
  280.         (sizeChange != 0) ifTrue: [
  281.             expandBlock value: aSubBoite
  282.             With: ((curSizeBlock value: aSubBoite) + expandBit).
  283.             sizeChange: sizeChange - expandBit.
  284.         ].
  285.         ].
  286.     ].
  287.     ).
  288.  
  289.     fixUpFonts: aview = (
  290.     contents do: [| :aThing |
  291. "        ('Fixing up:',aThing printString) printLine."
  292.         aThing fixUpFonts: aview.
  293.     ].
  294.     ).
  295.  
  296.     bbox = (| bb. |
  297.     bb: rectangle copy.
  298.     contents do: [| :aThing |
  299.         bb: bb union: aThing bbox.
  300.     ].
  301.     bb
  302.     ).
  303.     contains: aBoite = (
  304.     (aBoite == self) ifTrue: [ ^true ].
  305.     contents do: [| :aThing |
  306.         (aThing contains: aBoite) ifTrue: [ ^true ].
  307.     ].
  308.     ^false
  309.     ).
  310.     leafsDo: aBlock = (
  311.     contents do: [| :aThing. |
  312.         aThing leafsDo: aBlock
  313.     ].
  314.     ).
  315. |)
  316.  
  317. aa boites traits hboite _Define: (|          
  318.     proto_parent** = aa boites traits proto_boite.
  319.     contentparent* = aa boites mixins containerboite.
  320.     boiteType = 'hboite'.
  321.     hboite    = true.
  322.     hexpandable = true.
  323.     
  324.     createLWViewOn: win At: aPoint = ( | curx. cury. |
  325.     curx: aPoint x.
  326.     cury: aPoint y.
  327.     contents do: [ | :aThing |
  328.         aThing createLWViewOn: win At: (curx@cury).
  329.         curx: curx + aThing xSize.
  330.     ]
  331.     ).
  332.     
  333.     " fixUpSizes propagates the minimum and maximum  "
  334.     " sizes up from the bottom level boxes and makes "
  335.     " the v and h-boxes the appropriate sizes        "
  336.     fixUpSizes      = ( | sum. newPosY. newNegY. |
  337.     sum: 0.
  338.     newPosY: 0.
  339.     newNegY: 0.
  340.     
  341.     "NOTE: The scheme code did this in four seperate loops"
  342.     contents do: [ | :aSubBoite | 
  343.         " First, fix up sub-boxes "
  344.         aSubBoite fixUpSizes.
  345.         
  346.         " Now set adjust size of container "
  347.         sum: sum + aSubBoite x.
  348.         newPosY: newPosY max: aSubBoite posy.
  349.         newNegY: newNegY max: aSubBoite negy.
  350.     ].
  351.     posy: newPosY.
  352.     negy: newNegY.
  353.     x: sum.
  354.     ).
  355.     
  356.     makeRequiredSizes: xSize PosY: yPosSize NegY: yNegSize = (| expandableXThings. newPosY. newNegY. curXSize. expandBit. sizeChange. |
  357.     expandableXThings: list copy.
  358.     contents do: [| :aSubBoite |
  359.         aSubBoite hexpandable ifTrue: [
  360.         expandableXThings add: aSubBoite.
  361.         ] False: [
  362.         aSubBoite makeRequiredSizes: (aSubBoite x) PosY: yPosSize NegY: yNegSize.
  363.         ].
  364.     ].
  365.  
  366.     expandSubBoites: expandableXThings From: x To: xSize
  367.         ChangeBlock: [| :aSubBoite. :desiredSize |
  368.             aSubBoite makeRequiredSizes: desiredSize
  369.            PosY: (aSubBoite posy)
  370.            NegY: (aSubBoite negy). ]
  371.         FetchBlock: [| :aSubBoite. |
  372.             aSubBoite x    ].
  373.     
  374.     newPosY: 0. newNegY: 0.
  375.     contents do: [ | :aSubBoite | 
  376.         " Now set adjust size of container "
  377.         newPosY: newPosY max: aSubBoite posy.
  378.         newNegY: newNegY max: aSubBoite negy.
  379.     ].
  380.     posy: newPosY.
  381.     negy: newNegY.
  382.     )
  383. |)
  384.  
  385. aa boites traits vboite _Define: (|
  386.     proto_parent** = aa boites traits proto_boite.
  387.     contentparent* = aa boites mixins containerboite.
  388.     boiteType = 'vboite'.
  389.     vboite    = true.
  390.     vexpandable = true.
  391.  
  392.     createLWViewOn: win At: aPoint = ( | curx. cury. |
  393.     curx: aPoint x.
  394.     cury: aPoint y - posy.
  395.     contents do: [ | :aThing |
  396.         cury: cury + aThing posy.
  397. "        ('drawing: ',aThing printString,' at ',curx printString,'@',cury printString) printLine."
  398.         aThing createLWViewOn: win At: (curx@cury).
  399.         cury: cury + aThing negy.
  400.     ]
  401.     ).
  402.     
  403.     " fixUpSizes propagates the minimum and maximum  "
  404.     " sizes up from the bottom level boxes and makes "
  405.     " the v-boxes the appropriate sizes        "
  406.     " The vboite version does some additional work the hboite "
  407.     " one does not need. It attempts to divide the the vertical "
  408.     " box into two parts --- the part above the hline (if any) "
  409.     " and the part below it. The two sizes become the pos/neg y "
  410.     " sizes. "
  411.     
  412.     fixUpSizes      = ( | xWidth. above. yHeight. |
  413.     xWidth: x.
  414.     above: true.
  415.     yHeight: 0.
  416.     contents do: [ | :aSubBoite | 
  417.         " First, fix up sub-boxes "
  418.         aSubBoite fixUpSizes.
  419.         
  420.         " Now set adjust size of container "
  421.         xWidth: xWidth max: aSubBoite x.
  422.     
  423.         ((aSubBoite == baseLineBoite) && above) ifTrue: [
  424.         above: false.
  425.         yHeight: yHeight + aSubBoite posy.
  426.         posy: yHeight.
  427.         yHeight: aSubBoite negy.
  428.         ] False: [
  429.         yHeight: yHeight + aSubBoite height.
  430.         ].
  431.         
  432.     ].
  433.     x: xWidth.
  434.     above ifTrue: [
  435.         posy: yHeight.
  436.         negy: 0.
  437.     ] False: [
  438.         negy: yHeight.
  439.     ].
  440.     ).
  441.     
  442.     " Make required size's job is to expand the glue and sub-container types "
  443.     " so that they fill/fit in the available space. This code is translated "
  444.     " from the Scheme, although oop reorganizes it a bit. "
  445.     " With full font support it should be possible to make even more "
  446.     " complicated decisions "
  447.     " XXX --- this code does not at present pay attention to baselines "
  448.     "    in a vboite! "
  449.     
  450.     makeRequiredSizes: xSize PosY: yPosSize NegY: yNegSize = (| expandableYThings. newWidth. baseline. |
  451.     expandableYThings: list copy.
  452.  
  453.     contents do: [ | :aSubBoite |
  454.         aSubBoite vexpandable ifTrue: [
  455.         expandableThings add: aSubBoite.
  456.         ] False: [
  457.         aSubBoite makeRequiredSizes: xSize PosY: (aSubBoite posy) NegY: (aSubBoite negy).
  458.         ].
  459.     ].
  460.  
  461.     expandSubBoites: expandableYThings From: posy To: yPosSize
  462.         ChangeBlock: [| :aSubBoite. :desiredSize |
  463.             aSubBoite makeRequiredSizes: xSize
  464.            PosY: desiredSize
  465.            NegY: (aSubBoite negy). ]
  466.         FetchBlock: [| :aSubBoite. |
  467.             aSubBoite posy    ].
  468.  
  469.     newWidth: 0.
  470.     baseline: 0.
  471.     contents do: [ | :aSubBoite | 
  472.         " Now set adjust size of container "
  473.         newWidth: newWidth max: aSubBoite x.
  474.         baseline: baseline + aSubBoite posy.
  475.         (aSubBoite == baseLineBoite) ifTrue: [
  476.         upheight value: baseline.
  477.         baseline: 0.
  478.         ].
  479.         baseline: baseline + aSubBoite negy.
  480.     ].
  481.     downheight value: baseline.
  482.     x: newWidth.
  483.     ).
  484. |)
  485.  
  486. aa boites mixins textboite _Define: (|
  487.     " should eventually pick the smallest font. "
  488.  
  489.     setMinSizes = ().
  490.     fixUpSizes  = ().
  491.     setText: someText = ( 
  492.     text: someText.
  493.     calculateSizes.
  494.     ).
  495.  
  496.     creating* = (|
  497.     make: someText = (|new|
  498.         new: copy.
  499.         new setText: someText.
  500.         new
  501.     ).
  502.  
  503.     roman: string = ( | b. |
  504.         b: copy.
  505.         b fontPrefix: '-*-helvetica-medium-r-normal-*-'.
  506.         b setText: string.
  507.         ^b
  508.     ).
  509.     italic: string = ( | b. |
  510.         b: copy.
  511.         b fontPrefix: '-*-helvetica-medium-o-normal-*-'.
  512.         b setText: string.
  513.         ^b
  514.     ).
  515.     symbol: string = ( | b. |
  516.         b: copy.
  517.         b fontPrefix: '-*-symbol-medium-r-normal-*-'.
  518.         b setText: string.
  519.         ^b
  520.     ).
  521.     |).
  522.  
  523. |)
  524.  
  525. aa boites traits htext _Define: (|
  526.     proto_parent** = aa boites traits proto_boite.
  527.     htext_parent*  = aa boites mixins textboite.
  528.     
  529.     copy    = (|new|
  530.     new: proto_parent.copy.        
  531.     allowedFontSizes: allowedFontSizes copy.
  532.     ^new
  533.     ).
  534.     boiteType = 'htext'.
  535.  
  536.     smallestFontSize = ( allowedFontSizes first ).
  537.     largestFontSize  = ( allowedFontSizes last  ).
  538.     _ calculateSizes = (| len. |
  539.     len: text size.
  540.     upheight lower: 0.
  541.     upheight value: curFontSize.
  542.     downheight lower: 0.
  543.     downheight value: 0.
  544.     width lower: 0.
  545.     width value: curFontSize * len.
  546.     curFontName: (fontPrefix,curFontSize printString, fontSuffix).
  547.     self
  548.     ).
  549.     printString = ( |str|
  550.     str: 'An htext containing: \'',text,'\'',sizeString.
  551.     ^str
  552.     ).
  553.     createLWViewOn: vue At: aPoint = (| nv. |
  554.     nv: aa views boiteView copyForBoite: self At: aPoint.
  555.     vue addSubView: nv.
  556.     vue boiteSubViews at: self Put: nv.
  557.     ).
  558.  
  559.     drawOn: vue At: aPoint = (
  560.     vue drawAt: aPoint
  561.           String:  text
  562.           InFontNamed: curFontName
  563.     ).
  564.  
  565.     fixUpFonts: view = (| fontStruct. |
  566.     fontStruct: view openFontNamed: curFontName.
  567.     width value: fontStruct xTextWidth: text.
  568.     upheight value: fontStruct ascent.
  569.     downheight value: fontStruct descent.
  570.     ).
  571. |)
  572.  
  573. " VTEXT NOT YET IMPLEMENTED! "
  574. aa boites traits vtext _Define: (|
  575.     proto_parent* = aa boites traits proto_boite.
  576.     copy    = (|new|
  577.     new: proto_parent.copy.        
  578.     allowedFontSizes: allowedFontSizes copy.
  579.     new
  580.     ).
  581.     make: someText = (|new|
  582.     new: copy.
  583.     new setText: someText.
  584.     new
  585.     ).
  586.     setText: someText = (
  587.         text: someText.
  588.     calculateSizes.
  589.     ).
  590.     setBaseline: base = (
  591.     baseline: base.
  592.     calculateSizes.
  593.     ).
  594.     
  595.     smallestFontSize = ( allowedFontSizes first ).
  596.     largestFontSize  = ( allowedFontSizes last  ).
  597.     calculateSizes = ( | len. uplen. downlen. |
  598.     len:  text size.
  599.     width lower: smallestFontSize.
  600.     width upper: largestFontSize.
  601.     width value: curFontSize.
  602.     uplen: len - baseline. 
  603.     downlen: baseline.
  604.     upheight lower: smallestFontSize * uplen.
  605.     upheight upper: largestFontSize * uplen.
  606.     upheight value: curFontSize * uplen.
  607.     downheight lower: smallestFontSize * uplen.
  608.     downheight upper: largestFontSize * uplen.
  609.     downheight value: curFontSize * uplen.
  610.     curFontName: (fontPrefix,curFontSize printString, fontSuffix).
  611.     ).
  612.     printString = ( | str. |
  613.     str: 'A vtext containing:"',text,'"',sizeString.
  614.     ^str
  615.     ).
  616. |)
  617.  
  618. aa boites traits glueboite _Define: (|
  619.    proto_parent** = aa boites traits proto_boite.
  620.     createLWViewOn: view At: pt = ( self ).  " glue is invisible "
  621.     copy    = (| new. |
  622.     new: proto_parent.copy.        
  623.     new width lower: 0.
  624.     new upheight lower: 0.
  625.     new downheight lower: 0.
  626.     ^new
  627.     ).
  628. |)
  629.  
  630. aa boites traits hglue _Define: (|
  631.     glue_parent*   = aa boites traits glueboite.
  632.     hexpandable    = true.
  633.     boiteType      = 'HGlue'.
  634. |)
  635.  
  636. aa boites traits vglue _Define: (|
  637.     glue_parent*   = aa boites traits glueboite.
  638.     vexpandable    = true.
  639.     boiteType      = 'VGlue'.
  640. |)
  641.  
  642. aa boites traits hline _Define: (|
  643.     proto_parent* = aa boites traits proto_boite.
  644.     copy    = (| new. |
  645.     new: proto_parent.copy.        
  646.     new calculateThickness.
  647.     ^new
  648.     ).
  649.     calculateThickness = (
  650.     upheight lower: thickness.
  651.     upheight upper: thickness.
  652.     downheight lower: thickness.
  653.     downheight upper: thickness.
  654.     upheight value: 0.
  655.     downheight value: 0.
  656.  
  657.     width lower: thickness * 4.
  658.     width upper: infinity.
  659.     width value: 0.
  660.     ).
  661.     thickness: thick = (
  662.     iThickness: thick.
  663.     calculateThickness.
  664.     ^self
  665.     ).
  666.     thickness = ( iThickness ).
  667.     boiteType = 'HLine'.
  668.     vboiteCenters = true.
  669.  
  670.     drawing* = (|
  671.     createLWViewOn: vue At: pt = (
  672.         vue addSubView: aa views boiteView copyForBoite: self At: pt.
  673.     ).
  674.     
  675.     drawOn: vue At: pt = (
  676.         vue drawFrom: pt For: ((width value)@0) 
  677.     ).
  678.     |).
  679. |)
  680.  
  681. aa boites traits vline _Define: (|
  682.     proto_parent* = aa boites traits proto_boite.
  683.     copy    = (|new|
  684.     new: proto_parent.copy.        
  685.     new calculateThickness.
  686.     ^new
  687.     ).
  688.     calculateThickness = (
  689.     upheight lower: thickness.
  690.     downheight lower: thickness.
  691.     width lower: thickness.
  692.     width upper: thickness.
  693.  
  694.     upheight value: thickness.
  695.     downheight value: thickness.
  696.     width value: thickness.
  697.     ).
  698.     thickness: thick = (
  699.     iThickness: thick.
  700.     calculateThickness.
  701.     ^self
  702.     ).
  703.     thickness = ( iThickness ).
  704.     boiteType = 'VLine'.
  705.     drawing* = (|
  706.     createLWViewOn: vue At: pt = (
  707.         " set width! "
  708.         vue addSubView: aa views boiteView copyForBoite: self At: aPoint.
  709.     ).
  710.     
  711.     drawOn: vue At: pt = (| xHalf. |
  712.         xHalf: (pt x) + (xSize / 2).
  713.         vue drawFrom: xHalf@(pt y - (upheight value)) To: xHalf@(pt y + (downheight value))
  714.     ).
  715.     |).
  716. |)
  717.  
  718.  
  719. *            *
  720. * PROTOTYPES *
  721. *            *
  722. "
  723.  
  724. aa boites prototypes proto_boite _Define: (|
  725.     width <- aa bnum copy.
  726.     upheight <- aa bnum copy.
  727.     downheight <- aa bnum copy.
  728.     polyObject.
  729.     containedIn.
  730.     thisObjectPrints = true.
  731. |)
  732.  
  733. aa boites prototypes hboite _Define: aa boites prototypes proto_boite
  734. aa boites prototypes hboite _AddSlots: (|
  735.     parent* = aa boites traits hboite.
  736.     "_" contents <- list copy.
  737. |)
  738.  
  739. aa boites prototypes vboite _Define: aa boites prototypes proto_boite
  740. aa boites prototypes vboite _AddSlots: (|
  741.     parent* = aa boites traits vboite.
  742.     "_" contents <- list copy.
  743.     ^ baseLineBoite <- nil.
  744. |)
  745.  
  746. aa boites prototypes htext _Define: aa boites prototypes proto_boite
  747. aa boites prototypes htext _AddSlots: (|
  748.     parent* = aa boites traits htext.
  749.     text <- ''.
  750.     curFontName.
  751.     allowedFontSizes <- list copy add: 24.
  752.     fontPrefix <- '-*-Courier-medium-r-*-*-'.
  753.     curFontSize <- 24.
  754.     fontSuffix <- '-*-*-*-*-*-*-*'.
  755. |)
  756.  
  757. aa boites prototypes vtext _Define: aa boites prototypes proto_boite
  758. aa boites prototypes vtext _AddSlots: (|
  759.     parent* = aa boites traits vtext.
  760.     text <- ''.
  761.     baseline <- 0.
  762.     curFontName.
  763.     allowedFontSizes <- list copy add: 24.
  764.     fontPrefix <- '-*-Courier-medium-r-*-*-'.
  765.     curFontSize <- 24.
  766.     fontSuffix <- '-*-*-*-*-*-*-*'.
  767. |)
  768.  
  769. aa boites prototypes hglue _Define: aa boites prototypes proto_boite
  770. aa boites prototypes hglue _AddSlots: (|
  771.     parent* = aa boites traits hglue.
  772. |)
  773.  
  774. aa boites prototypes vglue _Define: aa boites prototypes proto_boite
  775. aa boites prototypes vglue _AddSlots: (|
  776.     parent* = aa boites traits vglue.
  777. |)
  778.  
  779. aa boites prototypes hline _Define: aa boites prototypes proto_boite
  780. aa boites prototypes hline _AddSlots: (|
  781.     parent* = aa boites traits hline.
  782.     iThickness <- 2.
  783. |)
  784.  
  785. aa boites prototypes vline _Define: aa boites prototypes proto_boite
  786. aa boites prototypes vline _AddSlots: (|
  787.     parent* = aa boites traits vline.
  788.     iThickness <- 1.
  789. |)
  790.  
  791.  
  792.  
  793.